/******************************************************************************
 *
 * @file       clickedlabel.h
 * @brief      registerDialod 界面，密码和确认密码后面的label，是否隐藏密码
 *
 * @author     ax
 * @date       2024/05/18
 * @history
 *****************************************************************************/

#ifndef CLICKEDLABEL_H
#define CLICKEDLABEL_H

#include <QLabel>

#include "global.h"
#include <QString>
#include <QMouseEvent>
#include <QDebug>

class ClickedLabel : public QLabel
{
    Q_OBJECT;
public:
    ClickedLabel(QWidget* parent);
    virtual void mousePressEvent(QMouseEvent *ev) override; // 处理鼠标点击事件
    virtual void mouseReleaseEvent(QMouseEvent *event) override; // 处理鼠标抬起事件
    virtual void enterEvent(QEvent *ev) override; // 鼠标处理悬停进入事件
    virtual void leaveEvent(QEvent *ev) override; // 处理鼠标悬停离开事件
    void SetState(QString normal = "", QString hover = "", QString press = "",
                QString select = "", QString select_hover = "", QString select_press = "");
    ClickLbState GetCurState();
    bool SetCurState(ClickLbState state);
private:
    QString _normal;
    QString _normal_hover;
    QString _normal_press;
    QString _selected;
    QString _selected_hover;
    QString _selected_press;

    ClickLbState _curstate; // 状态

signals:
    void clicked(QString, ClickLbState);
};

#endif // CLICKEDLABEL_H
